in-app-review 应用内评价

in-app-review 应用内评价

Google Play In-App Review API 可让您提示用户提交 Play 商店评分和评论,而无需离开您的应用或游戏。

一般来说, in-app review 流程(见下图)可以在应用的整个用户旅程中随时触发。在此流程中,用户可以使用 1 到 5 星系统对您的应用程序进行评分,并添加可选评论。提交后,评论将发送到 Play 商店并最终显示。

为了保护用户隐私并避免 API 滥用,您的应用程序应遵循有关何时请求应用程序内评论以及评论提示设计的严格准则,见 #何时请求 in-app review?

|900

要求

何时请求 in-app review?

请遵循以下指南来帮助您决定何时向用户请求 in-app reviews

设计指南

在确定如何将应用内评论集成到您的应用中时,请遵循以下准则:

Quotas 配额

为了提供出色的用户体验,Google Play 对向用户显示审阅对话框的频率强制执行有时限的配额。由于此配额,在短时间内(例如,不到一个月)多次调用 launchReviewFlow 方法可能并不总是显示对话框。

注意:配额的具体值是一个实施细节,Google Play 可以更改该值,恕不另行通知。

由于配额可能会发生变化,因此应用您自己的逻辑并瞄准请求审核的最佳时机非常重要。例如,您不应该使用号召性用语选项(例如按钮)来触发 API,因为用户可能已经达到了配额,并且不会显示流程,从而给用户带来糟糕的体验。对于此用例,请将用户重定向到 Play 商店。

集成 in-app reviews (Kotlin)

// In your app’s build.gradle.kts file:
...
dependencies {
    // This dependency is downloaded from the Google’s Maven repository.
    // So, make sure you also include that repository in your project's build.gradle file.
    implementation("com.google.android.play:review:2.0.1")

    // For Kotlin users also import the Kotlin extensions library for Play In-App Review:
    implementation("com.google.android.play:review-ktx:2.0.1")
    // ...
}

ReviewManager 是让您的应用启动应用内审核流程的界面

val manager = ReviewManagerFactory.create(context)
val request = manager.requestReviewFlow()
request.addOnCompleteListener { task ->
    if (task.isSuccessful) {
        // We got the ReviewInfo object
        val reviewInfo = task.result
    } else {
        // There was some problem, log or handle the error code.
        @ReviewErrorCode val reviewErrorCode = (task.getException() as ReviewException).errorCode
    }
}

注意: ReviewInfo 对象仅在有限的时间内有效。您的应用应提前(预缓存)请求 ReviewInfo 对象,但前提是您确定您的应用将启动 in-app review 流程。

使用 ReviewInfo 实例启动应用内审核流程。等到用户完成应用内审核流程后,您的应用程序才会继续其正常用户流程(例如进入下一个级别)。

val flow = manager.launchReviewFlow(activity, reviewInfo)
flow.addOnCompleteListener { _ ->
    // The flow has finished. The API does not indicate whether the user
    // reviewed or not, or even whether the review dialog was shown. Thus, no
    // matter the result, we continue our app flow.
}

重要提示:如果在应用内审核流程中发生错误,请勿通知用户或更改应用的正常用户流程。调用 onComplete 后继续应用的正常用户流程。

测试应用内评价  |  Android 开发者  |  Android Developers

集成 in-app reviews native(C/C++)

集成应用内评价(原生)  |  Android 开发者  |  Android Developers

Ref